package com.william.jdbcplus.core.toolkit;

import com.william.jdbcplus.core.meta.TableHelperUtil;
import com.william.jdbcplus.core.toolkit.lambda.LambdaUtils;
import com.william.jdbcplus.core.toolkit.lambda.support.SFunction;

/**
 * 通用操作
 */
public class WrapUtil {
    public static <T> String getColumn(SFunction<T, ?> func) {
        String fieldName = LambdaUtils.getFieldProperty(func);
        Class<?> clazz = LambdaUtils.getFuncClass(func);
        String tableName = TableHelperUtil.getTableName(clazz);
        String colunmString = TableHelperUtil.getEntityFieldColumn(clazz, fieldName);
        return tableName + StringPool.DOT + colunmString;
    }

    public static String getTable(Class<?> clazz) {
        String tableName = TableHelperUtil.getTableName(clazz);
        return tableName;
    }

}
